package com.yunxi.controller.sto;

import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.sto.pojo.StoStockInQueryVO;
import com.yunxi.sto.pojo.StoStockInVO;
import com.yunxi.sto.service.StoStockInDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 车辆入库单 前端控制器
 * </p>
 *
 * @author caoYong
 * @since 2019-05-20
 */
@RestController
@RequestMapping("/admin/stoStockIn")
@Api(tags = "sto:stockIn", description = "车辆入库单接口")
public class StoStockInController {
 private static final Logger logger = LoggerFactory.getLogger(StoStockInController.class);

 /*@Reference(version = "${demo.service.version}",
           application = "${dubbo.application.id}",
           url = "${dubbo.application.url}",
           check = false,
           timeout = 10000)*/
 @Autowired
 StoStockInDubboService stoStockInDubboService;

 @GetMapping("/page")
 @ApiOperation(value = "查询分页")
 public ApiResult page(StoStockInQueryVO stoStockInQueryVO, @RequestParam(required = true)Integer pageNum, @RequestParam(required = true)Integer pageSize) throws Exception {
  return ResponseUtil.ok(stoStockInDubboService.findPageByVO(stoStockInQueryVO,pageNum,pageSize));
 }

 @GetMapping("/load")
 @ApiOperation(value = "读取单个")
 @ApiImplicitParam(paramType="query", name = "stockInId", value = "主键id", required = true, dataType = "String")
 public ApiResult load(String stockInId, @CurrentUser LoginInfo loginInfo) throws Exception {
 return ResponseUtil.ok(stoStockInDubboService.getById(stockInId));
}

 /*@PostMapping("/save")
 @ApiOperation(value = "保存信息")
 public ApiResult save(@RequestBody StoStockInVO stoStockInVO,@CurrentUser LoginInfo loginInfo) throws Exception {
    stoStockInDubboService.saveOrUpdate(stoStockInVO);
  return ResponseUtil.ok("success");
}

 @PostMapping("/del")
 @ApiOperation(value = "删除")
 public ApiResult del(@RequestBody StoStockInVO stoStockInVO) throws Exception {
    stoStockInDubboService.removeById(stoStockInVO.getId());
 return ResponseUtil.ok("success");
 }*/

/*@PostMapping("/export")
@ApiOperation(value = "导出excel")
public Object export(@RequestParam Map<String,Object> params) throws Exception {
return ResponseUtil.ok(stoStockInDubboService.findMapByList(params));
}*/
}
